package pers.amos.eshop.advance.product.mapper;

import org.apache.ibatis.annotations.*;
import pers.amos.eshop.advance.product.model.Category;


@Mapper
public interface CategoryMapper {
	
	@Insert("INSERT INTO category(name,description) VALUES(#{name},#{description})")
	@Options(keyColumn = "id", keyProperty = "id", useGeneratedKeys = true)
	void add(Category category);
	
	@Update("UPDATE category SET name=#{name},description=#{description} WHERE id=#{id}")  
	 void update(Category category);
	
	@Delete("DELETE FROM category WHERE id=#{id}")  
	 void delete(Long id);
	
	@Select("SELECT * FROM category WHERE id=#{id}")  
	 Category findById(Long id);
}
